package com.sport.video.common.enums;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
* 返回信息枚举
*@Author Gred
*@Date 2019/3/4 16:39
*@version 1.0
**/
public enum RespEnum{

    SUCCESS(0, "请求成功"),
    ERROR(999, "系统繁忙，请稍后重试"),
    EROOR_FAIL_VERIFY(901,"验签失败"),
    ERROR_REQ_MSG_NOT_EMPTY(902,"请求消息不允许为空"),
    ERROR_REPORT_ENC_FAIL(903,"报文加解密失败"),
    ERROR_REQUEST_MSG_ILLEGAL(904,"请求格式非法"),
    ERROR_APP_ID_EMPTY(905,"应用编号为空"),
    ERROR_APP_ID_ILLEGAL(906,"应用编号非法"),
    ERROR_UNKOWN_SERVICEID(907,"未知服务ID"),
    ERROR_TIMESTAMP_EMPTY(908,"请求时间戳为空"),
    ERROR_VERSION_EMPTY(909,"版本信息为空");

    public final Integer code;
    public final String msg;


    RespEnum(final Integer code, final String msg) {
        this.msg = msg;
        this.code = code;
    }

    public Serializable getMsg() {
        return this.msg;
    }

    public int getCode() {
        return this.code;
    }

    static Map<Object, RespEnum> enumMap = new HashMap<>();
    static {
        for (RespEnum type : RespEnum.values()) {
            enumMap.put(type.getCode(), type);
        }
    }

    public static RespEnum getEnum(String code) {
        return enumMap.get(code);
    }
}
